/*
 * SBMap.cpp
 *
 *  Created on: 03/09/2008
 *      Author: samuel.grigolato
 */

#include "SBMap.h"

SBMap::SBMap() {
	//
}

SBMap::~SBMap() {
	//
}

void SBMap::CriaItens(std::vector<CObjeto*> Objetos) {

	int TotalObjetos = Objetos.size();
	int TotalFogo = (int) (TotalObjetos * 0.15);
	int TotalPatins = (int) (TotalObjetos * 0.10);
	int TotalBomba = (int) (TotalObjetos * 0.15);

	int i = 0;
	srand(SDL_GetTicks());
	while (i < TotalFogo) {
		double r = ((double) rand() / ((double) (RAND_MAX) + (double) (1)));
		int ProximoFogo = (int) (r * TotalObjetos);
		if (Objetos[ProximoFogo]->Item == NULL) {
			Objetos[ProximoFogo]->Item = new SBItemFogo();
			i++;
			srand(SDL_GetTicks());
		}
	}

	i = 0;
	srand(SDL_GetTicks());
	while (i < TotalPatins) {
		double r = ((double) rand() / ((double) (RAND_MAX) + (double) (1)));
		int ProximoPatins = (int) (r * TotalObjetos);
		if (Objetos[ProximoPatins]->Item == NULL) {
			Objetos[ProximoPatins]->Item = new SBItemPatins();
			i++;
			srand(SDL_GetTicks());
		}
	}

	i = 0;
	srand(SDL_GetTicks());
	while (i < TotalBomba) {
		double r = ((double) rand() / ((double) (RAND_MAX) + (double) (1)));
		int ProximaBomba = (int) (r * TotalObjetos);
		if (Objetos[ProximaBomba]->Item == NULL) {
			Objetos[ProximaBomba]->Item = new SBItemBomba();
			i++;
			srand(SDL_GetTicks());
		}
	}

}


